PREFIX = /usr/local
VERSION = 0.0.9.3
build: clean
	mkdir ./build
	cp -R ./share ./build
	cp -R ./bin ./build
	rm -rf `find ./build -type d -name ".svn"`

clean:
	rm -rf `find ./ -type f -name "*.pyc"`
	rm -rf ./build
	rm -rf ./packages
	rm -rf ./*.spec
	rm -rf */*.tgz
install:
	cp -R ./build/share ${PREFIX}/
	cp -R ./build/bin ${PREFIX}/

uninstall:
	rm -rf ${PREFIX}/simpledcpp/
	rm -rf ${PREFIX}/bin/simpledcpp

package: build
	mkdir packages
	@echo "Simple client for DC++ networks." > ./description-pak
	@echo "#!/bin/bash\n\
rm -rf ${PREFIX}/share/simpledcpp/\n\
rm -rf ${PREFIX}/bin/simpledcpp\
	" > ./preremove-pak
	checkinstall --install=no -y --pkgname=simpledcpp --pkgversion=${VERSION} --pkggroup="internet" --pkgsource="http://code.google.com/p/simpledcpp/" --maintainer="nix.n0uk@gmail.com" --pkgrelease=0.1 --requires="python-notify,tthsum,python-glade2,python-gtk2,python-psyco,python-pyinotify" --pakdir=./packages/ > /dev/null 2>&1
	rm -rf ./description-pak
	rm -rf ./preremove-pak
	rm -rf ./doc-pak
	@echo "Now you can install package: sudo dpkg -i ./packages/simpledcpp_${VERSION}-0.1_i386.deb"

fedorapackage: build
	mkdir packages
	@echo "Simple client for DC++ networks." > ./description-pak
	@echo "#!/bin/bash\n\
rm -rf ${PREFIX}/share/simpledcpp/\n\
rm -rf ${PREFIX}/bin/simpledcpp\
        " > ./preremove-pak
	checkinstall --install=no -y -R --pkgname=simpledcpp --pkgversion=${VERSION} --pkggroup="internet" --pkgsource="http://code.google.com/p/simpledcpp/" --maintainer="nix.n0uk@gmail.com" --pkgrelease=0.1 --requires="python,notify-python,tthsum,glade2,pygtk2,python-psyco,python-inotify" --pakdir=./packages/ > /dev/null 2>&1 
	rm -rf ./description-pak
	rm -rf ./preremove-pak
	rm -rf ./doc-pak
	@echo "Now you can install package: sudo rpm -i ./packages/simpledcpp_${VERSION}-0.1_i386.rpm"

locales:
	msgmerge -U ./src/ru.po ./src/simpledcpp.pot
	msgfmt ./src/ru.po -o ./share/simpledcpp/i18n/ru/LC_MESSAGES/simpledcpp.mo
